﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <div>
    <el-form ref="formRefBadCodeTemplate" :model="stateBadCodeTemplate.vmModel" label-width="100px">
      <el-row>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_AddTime_FormItem" prop="Entity.AddTime" :label="$t('message.autotrans._Model_BadCodeTemplate_addTime')">
            <el-date-picker v-model="stateBadCodeTemplate.vmModel.Entity.AddTime" type='date' clearable></el-date-picker>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_BadCode_FormItem" prop="Entity.BadCode" :label="$t('message.autotrans._Model_BadCodeTemplate_badCode')">
            <el-input v-model="stateBadCodeTemplate.vmModel.Entity.BadCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_BadName_FormItem" prop="Entity.BadName" :label="$t('message.autotrans._Model_BadCodeTemplate_badName')">
            <el-input v-model="stateBadCodeTemplate.vmModel.Entity.BadName" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_BadTypeCode_FormItem" prop="Entity.BadTypeCode" :label="$t('message.autotrans._Model_BadCodeTemplate_badTypeCode')">
            <el-input v-model="stateBadCodeTemplate.vmModel.Entity.BadTypeCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_BadTypeName_FormItem" prop="Entity.BadTypeName" :label="$t('message.autotrans._Model_BadCodeTemplate_badTypeName')">
            <el-input v-model="stateBadCodeTemplate.vmModel.Entity.BadTypeName" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_DataStatus_FormItem" prop="Entity.DataStatus" :label="$t('message.autotrans._Model_BadCodeTemplate_dataStatus')">
            <el-input v-model="stateBadCodeTemplate.vmModel.Entity.DataStatus" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_EditTime_FormItem" prop="Entity.EditTime" :label="$t('message.autotrans._Model_BadCodeTemplate_editTime')">
            <el-date-picker v-model="stateBadCodeTemplate.vmModel.Entity.EditTime" type='date' clearable></el-date-picker>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_EnableStatus_FormItem" prop="Entity.EnableStatus" :label="$t('message.autotrans._Model_BadCodeTemplate_enableStatus')">
            <el-input v-model="stateBadCodeTemplate.vmModel.Entity.EnableStatus" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_FactoryCode_FormItem" prop="Entity.FactoryCode" :label="$t('message.autotrans._Model_BadCodeTemplate_factoryCode')">
            <el-input v-model="stateBadCodeTemplate.vmModel.Entity.FactoryCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Field1_FormItem" prop="Entity.Field1" :label="$t('message.autotrans._Model_BadCodeTemplate_field1')">
            <el-input v-model="stateBadCodeTemplate.vmModel.Entity.Field1" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Field2_FormItem" prop="Entity.Field2" :label="$t('message.autotrans._Model_BadCodeTemplate_field2')">
            <el-input v-model="stateBadCodeTemplate.vmModel.Entity.Field2" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Field3_FormItem" prop="Entity.Field3" :label="$t('message.autotrans._Model_BadCodeTemplate_field3')">
            <el-input v-model="stateBadCodeTemplate.vmModel.Entity.Field3" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Field4_FormItem" prop="Entity.Field4" :label="$t('message.autotrans._Model_BadCodeTemplate_field4')">
            <el-input v-model="stateBadCodeTemplate.vmModel.Entity.Field4" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Field5_FormItem" prop="Entity.Field5" :label="$t('message.autotrans._Model_BadCodeTemplate_field5')">
            <el-input v-model="stateBadCodeTemplate.vmModel.Entity.Field5" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OperationCode_FormItem" prop="Entity.OperationCode" :label="$t('message.autotrans._Model_BadCodeTemplate_operationCode')">
            <el-input v-model="stateBadCodeTemplate.vmModel.Entity.OperationCode" clearable></el-input>
        </el-form-item>

        </el-col>
      </el-row>

      <div style="text-align:right;">
        <WtmButton @click="onSubmitBadCodeTemplate"  type="primary" :button-text="$t('message.autotrans.SysSubmit')" style="margin-top:15px;"/>

        <WtmButton @click="onCloseBadCodeTemplate"  type="primary" :button-text="$t('message.autotrans.SysClose')" style="margin-top:15px;"/>

      </div>

    </el-form>

  </div>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageGetDataBadCodeTemplateCreate;false">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { badcodetemplateApi } from '/@/api/getdata/badcodetemplate';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;


// 定义变量内容
const formRefBadCodeTemplate = ref();
const stateBadCodeTemplate = reactive({
    vmModel: {
	  Entity:{
        AddTime: undefined,
        BadCode: '',
        BadName: '',
        BadTypeCode: '',
        BadTypeName: '',
        DataStatus: '',
        EditTime: undefined,
        EnableStatus: '',
        FactoryCode: '',
        Field1: '',
        Field2: '',
        Field3: '',
        Field4: '',
        Field5: '',
        OperationCode: '',
      },

	},
    
});

// 取消
const onCloseBadCodeTemplate = () => {
    closeDialog();
};

// 提交
const onSubmitBadCodeTemplate = () => {
 	const loadingInstance = ElLoading.service({
		lock: true,
		text: '正在提交中，请等待。。。',
		background: 'rgba(0, 0, 0, 0.7)',
	});
   formRefBadCodeTemplate.value?.validate((valid: boolean, fields: any) => {
		if (valid) {
            badcodetemplateApi().add(stateBadCodeTemplate.vmModel).then(() => {
                ElMessage.success(ci.proxy.$t('message._system.common.vm.submittip'));
                emit('refresh');
                closeDialog();
            }).catch((error) => {
                other.setFormError(ci, error);
            }).finally(() => {
			loadingInstance.close();
		    })
		}
	})
};

// 页面加载时
onMounted(() => {
    
});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

